<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<html>
<head>
    <jsp:include page="/public/inc/head.jsp"/>
</head>
<body>
<div id="header" class="navbar navbar-static-top" role="navigation">
    <jsp:include page="/public/inc/top.jsp"/>
</div>
<div class="container-fluid" style="margin-top:5px;margin-bottom:60px;">
    <div class="row">
        <jsp:include page="/public/inc/menu.jsp"/>
        <div class="col-xs-12 col-sm-10">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <div class="media">
                        <div class="media-body">
                            <span class="glyphicon glyphicon-list"></span>白名单管理》订购白名单
                        </div>
                        <shiro:hasPermission name="button:add:9" >
                            <div class="media-right">
                                <a href="/system/whitepurchase/white_purchase_edit" class="btn btn-primary">
                                    <span class="glyphicon glyphicon-plus"></span> 添加白名单用户
                                </a>
                            </div>
                        </shiro:hasPermission>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="form-inline">
                        <form action="/system/whitepurchase/white_purchase_list" method="post">
                            用户ID: <input type="text" class="form-control" name="userid"
                                         placeholder="唯一标识"/>&nbsp;&nbsp;&nbsp;&nbsp;
                            用户昵称： <input type="text" class="form-control" name="nickname"
                                         placeholder="用户昵称"/>
                            <button type="submit" class="btn btn-primary">筛选</button>
                        </form>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>序列号</th>
                            <th>用户ID</th>
                            <th>用户昵称</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="l" items="${list}" varStatus="status">
                            <tr>
                                <td>
                                        ${status.count}
                                </td>
                                <td>
                                        ${l.userid}
                                </td>
                                <td>
                                        ${l.nickname}
                                </td>
                                <td>
                                    <a class="btn btn-danger btn-xs" onclick="del('${l.userid}');">
                                        <span class="glyphicon glyphicon-trash"></span> 清空
                                    </a>
                                    <shiro:hasRole name="super">
                                        <a class="btn btn-danger btn-xs" onclick="cancel('${l.userid}');">
                                            <span class="glyphicon glyphicon-trash"></span> 取消
                                        </a>
                                    </shiro:hasRole>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
                <div class="panel-footer">
                    <p:pagination url="/system/whitepurchase/white_purchase_list" total="${listSize}"/>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/public/inc/bottom.jsp"/>
</body>
</html>
<script type="text/javascript">
    function del(userid) {
        if (window.confirm("确认要清空？")) {
            window.location.href = "/system/whitepurchase/clear?userid=" + userid;
        }
    }

    function cancel(userid) {
        if (window.confirm("确认要取消？")) {
            window.location.href = "/system/whitepurchase/white_purchase_save?white=0&userid=" + userid;
        }
    }
</script>